﻿using System;

namespace HslCommunication.Core.IMessage
{
	/// <summary>
	/// 西门子S7协议的消息解析规则
	/// </summary>
	// Token: 0x02000162 RID: 354
	public class S7Message : INetMessage
	{
		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ProtocolHeadBytesLength" />
		// Token: 0x17000608 RID: 1544
		// (get) Token: 0x06001DB1 RID: 7601 RVA: 0x0008D47D File Offset: 0x0008B67D
		public int ProtocolHeadBytesLength
		{
			get
			{
				return 4;
			}
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.HeadBytes" />
		// Token: 0x17000609 RID: 1545
		// (get) Token: 0x06001DB2 RID: 7602 RVA: 0x0008DC2B File Offset: 0x0008BE2B
		// (set) Token: 0x06001DB3 RID: 7603 RVA: 0x0008DC33 File Offset: 0x0008BE33
		public byte[] HeadBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ContentBytes" />
		// Token: 0x1700060A RID: 1546
		// (get) Token: 0x06001DB4 RID: 7604 RVA: 0x0008DC3C File Offset: 0x0008BE3C
		// (set) Token: 0x06001DB5 RID: 7605 RVA: 0x0008DC44 File Offset: 0x0008BE44
		public byte[] ContentBytes { get; set; }

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.CheckHeadBytesLegal(System.Byte[])" />
		// Token: 0x06001DB6 RID: 7606 RVA: 0x0008DC50 File Offset: 0x0008BE50
		public bool CheckHeadBytesLegal(byte[] token)
		{
			bool flag = this.HeadBytes == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = this.HeadBytes[0] == 3 && this.HeadBytes[1] == 0;
				result = flag2;
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetContentLengthByHeadBytes" />
		// Token: 0x06001DB7 RID: 7607 RVA: 0x0008DC98 File Offset: 0x0008BE98
		public int GetContentLengthByHeadBytes()
		{
			byte[] headBytes = this.HeadBytes;
			bool flag = headBytes != null && headBytes.Length >= 4;
			int result;
			if (flag)
			{
				result = (int)this.HeadBytes[2] * 256 + (int)this.HeadBytes[3] - 4;
			}
			else
			{
				result = 0;
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetHeadBytesIdentity" />
		// Token: 0x06001DB8 RID: 7608 RVA: 0x00047BE1 File Offset: 0x00045DE1
		public int GetHeadBytesIdentity()
		{
			return 0;
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.SendBytes" />
		// Token: 0x1700060B RID: 1547
		// (get) Token: 0x06001DB9 RID: 7609 RVA: 0x0008DCE0 File Offset: 0x0008BEE0
		// (set) Token: 0x06001DBA RID: 7610 RVA: 0x0008DCE8 File Offset: 0x0008BEE8
		public byte[] SendBytes { get; set; }
	}
}
